package exam.test;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Administrator
 * Date: 2020-06-15
 * Time: 17:56
 */
public class UserInput {

    public static class TextInput{
        StringBuffer currentValue = new StringBuffer();

        public void add(char c) {
            currentValue.append(c);
        }

        public String getValue() {
            return currentValue.toString();
        }
    }

    public static class NumericInput extends TextInput{

        public void add(char c) {
            if (c >= '0' && c <= '9') {
                currentValue.append(c);
            }
        }
    }
}
